How do I use wxEuphoria?
wxEuphoria is designed to be very similar to other Euphoria GUI libraries (i.e.,
Win32Lib). Although I recommend downloading the wxWidgets documentation, a
program written in wxEuphoria will take a different form than a C++ program
written using wxWidgets. In wxEuphoria, you don't have to worry about
creating a class derived from wxApp, or overloading an OnInit() function.
All you need to do is to create your controls, define and connect your event
handlers, and start the wxEuphoria event loop. Below is a basic outline
of what a wxEuphoria program might look like:
code
[include statements]
[create the controls]
[event handlers and other code]
wxMain()
endcode
Here is the classic 'Hello World!' program written in wxEuphoria (see hello_world.exw):
code
include wxeud.
constant
HelloFrame = create( wxFrame, {0, -1, "My First Message", -1, -1, 200, 100} ),
HelloWin = create( wxPanel, {HelloFrame})
procedure onPaint_HelloWin( atom this, atom event, atom it, atom event_type )
wx_puts( this, "Hello, World!")
end procedure
set_event_handler( HelloWin, get_id(HelloWin), wxEVT_PAINT, routine_id( "onPaint_HelloWin" ))
wxMain( HelloFrame )
endcode
Notice the syntax of the calls to
create(). This is the standard function
that should be called to create an object of almost any wxEuphoria class that
is wrapped. The class documentation should indicate what the second parameter
(always a sequence) should be. Many classes have
optional parameters. You
can omit these parameters if the default values are acceptable. Note that if
the third and fourth parameters are optional, you can't specify the fourth and
not the third--i.e., you can't skip parameters in the middle of the list.
Unfortunately, all functions and classes haven't been documented as consistently
or as thourough as they should be. If something in particular doesn't make sense,
please ask (best is the
Euphoria
forum), and I'll try to correct the situation. Contributions, in the
form of code and/or documentation are also welcomed and encouraged.
Subtopics:
Demos